// Subject类
import java.util.ArrayList;
import java.util.List;

public class Subject {
    private List<Student> students = new ArrayList<>();

    public void addStudent(Student student) {
        if (students.size() < 5) {
            students.add(student);
        } else {
            System.out.println("每门课程最多可容纳五名学生");
        }
    }

    public List<Student> getStudents() {
        return students;
    }
}
